﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HitachiLib.HitachiServiceRef;

namespace HitachiLib.Data
{
    public class SchedulePolicy
    {
        private SchedulePolicyData data;
        private bool[] common_mask = new bool[7];

        public bool[] CommonMask
        {
            get { return common_mask; }
        }

        public SchedulePolicyData Data
        {
            get { return data; }
            set { 
                data = value;
                int m = data.Mask;
                for (int i = 6; i >= 0; --i)
                {
                    common_mask[i] = (m & 1) > 0 ? true : false;
                    m = m >> 1;
                }
            }
        }

        public SchedulePolicy(int project_id)
        {
            data = new SchedulePolicyData();
            data.ProjectId = project_id;
            data.Mask = 0;
            common_mask[0] = false;
            common_mask[1] = false;
            common_mask[2] = true;
            common_mask[3] = true;
            common_mask[4] = true;
            common_mask[5] = true;
            common_mask[6] = true;
            for (int i = 0; i < 7; ++i)
            {
                Data.Mask += common_mask[i] ? 1 : 0;
                Data.Mask = Data.Mask << 1;
            }
            Data.Mask = Data.Mask >> 1;
        }
    }
}
